<?php
$this->pageTitle = t('BTN_EXPORT_DOCUMENT', 'profile');
$this->pageHeader = t('BTN_EXPORT_DOCUMENT', 'profile') . ' - Hồ sơ: '. Html::encode($model->full_name);

$fileListOfDirectory = array ();
$pathTofileListDirectory = MEDIA_FOLDER.'/files' ;

if(!is_dir($pathTofileListDirectory ))
{
    die(" Invalid Directory");
}

if(!is_readable($pathTofileListDirectory ))
{
    die("You don't have permission to read Directory");
}

foreach ( new DirectoryIterator ( $pathTofileListDirectory ) as $file ) {
    if ($file->isFile () === TRUE && $file->getBasename () !== '.DS_Store') {                	
    	if (in_array($file->getExtension(), array('docx', 'doc'))) {
            array_push ( $fileListOfDirectory, array('name'=>$file->getBasename('.'.$file->getExtension()), 'ext'=>$file->getExtension()));            
        }
    }
}
if(count($fileListOfDirectory) > 0)
{
	echo '<ul class="list-report">';
	foreach ($fileListOfDirectory as $fitem)
	{		
		echo '<li class="word">
		<a href="'.url('/translate/savereport', array('id'=>$model->id, 'alias'=>stringURLSafe($model->full_name), 'f'=>$fitem['name'],'ext'=>$fitem['ext'])).'">
		'.$fitem['name'].'</a></li>';
	}
	echo '</ul><div class="clrfix"></div>';
}
?>